package com.majx.service.impl;

import com.majx.mapper.NewsMapper;
import com.majx.pojo.News;
import com.majx.service.NewsService;

import java.util.List;
import java.util.Map;


public class NewsServiceImpl implements NewsService {
    private NewsMapper newsMapper;

    public void setNewsMapper(NewsMapper newsMapper) {
        this.newsMapper = newsMapper;
    }

    /**
     * 查询5条新闻分页数据
     * @param startRow
     * @return
     */
    public List<News> queryNewsPage(Integer startRow) {
        return newsMapper.queryNewsPage(startRow);
    }

    /**
     * 查询5条新闻分页数据----带条件
     * @param map
     * @return
     */
    public List<News> selectNewsPage(Map<Object, Object> map) {
        return newsMapper.selectNewsPage(map);
    }

    /**
     * 增加一条新闻记录
     * @param news
     * @return
     */
    public Integer addNews(News news) {
        return newsMapper.addNews(news);
    }

    /**
     * 更新一条新闻记录
     * @param news
     * @return
     */
    public Integer updateNews(News news) {
        return newsMapper.updateNews(news);
    }


    /**
     * 删除一条新闻记录
     * @param nid
     * @return
     */
    public Integer deleteNews(Integer nid) {
        return newsMapper.deleteNews(nid);
    }

    /**
     * 删除多条新闻记录
     * @param idList
     * @return
     */
    public Integer deleteNewsList(List<Integer> idList) {
        return newsMapper.deleteNewsList(idList);
    }

    /**
     * 获取新闻总数---带条件
     * @param map
     * @return
     */
    public Integer getNewsCount(Map<Object, Object> map) {
        return newsMapper.getNewsCount(map);
    }
}
